﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RoadTeam.FineFile.Code.TimeLineFile
{
   public class WriteFile
    {
       //输出时间轴的Html文件
       public String OutFilePath { get; set; }
       #region 创建HTML文件
       public StringBuilder CreateHtmlFile()
       {
           StringBuilder sb=new StringBuilder ();
sb.AppendLine(@"<!DOCTYPE html PUBLIC "+"-"+"//"+"W3C/"+"/DTD XHTML 1.0 Transitional//EN\""+ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
sb.AppendLine(@"<html xmlns="+"\"http:"+"//"+"www.w3.org"+"/"+"1999"+"/"+"xhtml\">");
sb.AppendLine(@"<head>");
sb.AppendLine(@"<title>更新记录</title>");
sb.AppendLine(@"<script src='jquery-1.6.js' type='text/javascript'></script>");
sb.AppendLine(@"<style type='text/css'>");
sb.AppendLine(@"ul.timeline");
sb.AppendLine(@"        {");
sb.AppendLine(@"            list-style-type: none;");
sb.AppendLine(@"            background: url("+"\"img/version_line.png"+"\") repeat-y scroll 220px 0 transparent;");
sb.AppendLine(@"            margin: 50px 0;");
sb.AppendLine(@"            padding: 0;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li");
sb.AppendLine(@"       {");
sb.AppendLine(@"           position: relative;");
sb.AppendLine(@"            margin-bottom: 20px;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li .time");
sb.AppendLine(@"        {");
sb.AppendLine(@"            position: absolute;");
sb.AppendLine(@"            width: 90px;");
sb.AppendLine(@"            text-align: right;");
sb.AppendLine(@"            left: 100px;");
sb.AppendLine(@"            top: 10px;");
sb.AppendLine(@"            color: #999;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li .version");
sb.AppendLine(@"        {");
sb.AppendLine(@"            position: absolute;");
sb.AppendLine(@"            width: 290px;");
sb.AppendLine(@"           text-align: right;");
sb.AppendLine(@"            left: -100px;");
sb.AppendLine(@"            top: 30px;");
sb.AppendLine(@"            font-size: 20px;");
sb.AppendLine(@"            line-height: 50px;");
sb.AppendLine(@"            color: #3594cb;");
sb.AppendLine(@"            overflow: hidden;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li .number");
sb.AppendLine(@"        {");
sb.AppendLine(@"            position: absolute;");
sb.AppendLine(@"            background: url("+"\"img/version_dot.png"+"\") no-repeat scroll 0 0 transparent;");
sb.AppendLine(@"           width: 56px;");
sb.AppendLine(@"            height: 56px;");
sb.AppendLine(@"            left: 197px;");
sb.AppendLine(@"            line-height: 56px;");
sb.AppendLine(@"            text-align: center; /*color: #fff;*/");
sb.AppendLine(@"            font-size: 18px;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li.alt .number");
sb.AppendLine(@"        {");
sb.AppendLine(@"            background-image: url("+"\"img/version_dot_alt.png"+"\");");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li .content");
sb.AppendLine(@"        {");
sb.AppendLine(@"            margin-left: 280px;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li .content pre");
sb.AppendLine(@"        {");
sb.AppendLine(@"            background-color: #3594cb;");
sb.AppendLine(@"            padding: 20px; /*color: #fff;*/");
sb.AppendLine(@"            font-size: 13px;");
sb.AppendLine(@"            line-height: 20px;");
sb.AppendLine(@"        }");
sb.AppendLine(@"        ul.timeline li.alt .content pre");
sb.AppendLine(@"        {");
sb.AppendLine(@"            background-color: #43B1F1;");
sb.AppendLine(@"        }");
sb.AppendLine(@"    </style>");
sb.AppendLine(@"    <script type='text/javascript'>");
sb.AppendLine(@"        $(function () {");
sb.AppendLine(@"            var nextDataNumber = 5;");
sb.AppendLine(@"            var ajaxLoading = false;");
sb.AppendLine(@"            var docNode = $(document);");
sb.AppendLine(@"            var ulNode = $('ul.timeline');");
sb.AppendLine(@"            function initLiNodes() {");
sb.AppendLine(@"                CreateLi();");
sb.AppendLine(@"                var liNodes = ulNode.find('li'), count = liNodes.length, i, liNode, leftCount = nextDataNumber * 20;");
sb.AppendLine(@"                for (i = 0; i < count; i++) {");
sb.AppendLine(@"                    liNode = $(liNodes.get(i));");
sb.AppendLine(@"                    if (i % 2 !== 0) {");
sb.AppendLine(@"                        liNode.addClass('alt');");
sb.AppendLine(@"                    } else {");
sb.AppendLine(@"                        liNode.removeClass('alt');");
sb.AppendLine(@"                    }");
sb.AppendLine(@"                    liNode.find('.number').text(leftCount + count - i);");
sb.AppendLine(@"                }");
sb.AppendLine(@"            }");
sb.AppendLine(@"            function CreateLi() {");
sb.AppendLine(@"                $.ajax({");
sb.AppendLine(@"                    type: 'POST',");
sb.AppendLine(@"                    url: 'ReadXmlHandler.ashx',");
sb.AppendLine(@"                    data: 't=' + new Date(),");
sb.AppendLine(@"                    success: function (msg) {");
sb.AppendLine(@"                        ulNode.append(msg);");
sb.AppendLine(@"                    }");
sb.AppendLine(@"                });");
sb.AppendLine(@"            }");
sb.AppendLine(@"            initLiNodes();");
sb.AppendLine(@"        });");
sb.AppendLine(@"    </script>");
sb.AppendLine(@"</head>");
sb.AppendLine(@"<body>");
sb.AppendLine(@"    <div style='width: 800px'>");
sb.AppendLine(@"        <ul class='timeline'>");
sb.AppendLine(@"        </ul>");
sb.AppendLine(@"    </div>");
sb.AppendLine(@"</body>");
sb.AppendLine(@"</html>");


return sb;
       }
       
        #endregion

    }


}
